#include <iostream>
#include "fun.h"
using namespace std;

//菜单
void menu()
{
	cout << "\t1.用户注册" << endl;
	cout << "\t2.用户登录" << endl;
	cout << "\t3.用户中心" << endl;
	cout << "\t4、搜索商品" << endl;
	cout << "\t5.浏览二手产品" << endl;
	cout << "\t6.出售产品" << endl;
	cout << "\t0.退出" << endl;
}

void User_Center()
{
	cout << "========用户中心===========" << endl;
	cout << "\t1.待付款订单" << endl;
	cout << "\t2.货物物流订单" << endl;
	cout << "\t3.用户修改" << endl;
}
int main()
{
	ZZ z;

	cout << RED << "===============欢迎来到转转简易版==============" << RESET << endl;
	cout << YELLOW << "\t二手拯救世界，省心买，放心买！" << RESET << endl;

	int choice;
	while (1)
	{
		cout << endl;
		menu();
		cout << "请选择（0~6):";
		cin >> choice;

		switch (choice)
		{
		case 1:
			z.Register();
			break;
		case 2:
			z.Login();
			break;
		case 3:
			//DL为0，说明还没有登陆过
			if (DL == 0)
			{
				cout << "您还没有登录，请先登录！" << endl;
				break;
			}
			int n;
			User_Center();
			cout << "请选择：";
			cin >> n;
			//选择的用户中心信息
			while (1)
			{
				if (n == 1)
				{
					z.PayL();
					break;
				}
				else if (n == 2)
				{
					z.GoodPost();
					break;
				}
				else if (n == 3)
				{
					z.Modify();
					break;
				}
				else {
					cout << "输入错误，请重新输入:";
					cin >> n;
				}
			}
			break;
		case 4:
			if (DL == 0)
			{
				cout << "您还没有登录，请先登录！" << endl;
				break;
			}
			z.Find();
			break;
		case 5:
			if (DL == 0)
			{
				cout << "您还没有登录，请先登录！" << endl;
				break;
			}
			z.Shopping();
			break;
		case 6:
			if (DL == 0)
			{
				cout << "您还没有登录，请先登录！" << endl;
				break;
			}
			z.Soil();
			break;
		case 0:
			break;
		default:
			cout << "输入有误，请重新输入(0~6):";
			cin >> choice;
		}

		if (choice == 0)
		{
			cout << YELLOW << "退出成功，感谢你的使用" << RESET << endl;
			break;
		}
	}


	return 0;
}